package org.itsky.study.test1;

/**
 * @Author sky
 * @Site cmtianxie163.com 2020/4/10 10:38
 */

import java.util.Arrays;
import java.util.List;

/**
 * 使用内循环代替外循环
 *
 * 遍历一个list
 */

public class LambdaTest2 {

    public static void main(String[] args) {
        List languages = Arrays.asList("java","python","php","lua","c++");

        //方式一
        for (Object o : languages) {
            System.out.println(o);
        }
        System.out.println("----------------------------");

        //方式二
        languages.forEach(n -> System.out.println(n));

    }


}
